Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
E9 Mike #1
Need help with goToURL
Good Evening,
I am trying to get the following Javascript and HTML code to function
correctly, but continuously receiving errors with the "else statement".
JAVASCRIPT
------------------
function goToURL()
{
pdtotal = document.myform1.productdensity1.value
if ( pdtotal >= 1 );
{
alert(" entering IF and GT or Equal to One (1) ");
window.location="05-CBM Freight Classes Page.htm";
}
else
{
alert(" entering ELSE and LT or Equal to Zero (0) ");
}
}
HTML
--------
<input type=button tabindex="4" value="Go To Next Screen"
onClick="goToURL()">
Thanks,
Mike
E9 Mike Guest
-
Datagrid gotoURL
Is it possible that on select of an item in the datagrid I can goto a url? I have been trying to figure this out but haven't seen anything posted... -
goToURL
How do I open a new page when using the goToURL behaviour. Here is code generated by Dreamweaver MX 4: <a href='javascript:;'... -
rilkesf #2
Re: Need help with goToURL
Mike,
I'm probably a bit too late, but figured I'd throw this up anyways.
I made some changes, but the following worked fine for me. I didn't know what
kind of form element 'productdensity1' was, so I just wrote it up as a text
field. So you'll have to change that part depending on your needs. Anyways,
here's the code:
/*--------------- Javascript -------------------------- */
function goToURL() {
var pdtotal = document.forms['myform1'].elements['productdensity1'].value;
if(pdtotal >= 1) {
alert('entered if statement');
window.location = 'http://www.yoursite.com/yourpage.html';
} else {
alert('entered else statement');
}
}
HTML
<form action="" name="myform" id="myform1">
<input type="text" name="productdensity1" id="productdensity1" value="test">
<input type="button" name="nextbutton" id="nextbutton" value="Go to next
screen" onClick="goToURL();">
</form>
rilkesf Guest
-
E9 Mike #3
Re: Need help with goToURL
rilkesf,
Thanks for the tip. I did finally figure it out, but , your comments were
beneficial and I will keep them for future use. I do have another question, I
am trying to figure out how to pass data from one form (web page 1) to another
form (web page 2), any thoughts.
E9
Mike:beer;:D:brokenheart;:camera;:brokenheart;:D:b eer;:beer;:D:brokenheart;:came
ra;:clock;:camera;:brokenheart;:D:beer;
E9 Mike Guest
-
-
rilkesf #5
Re: Need help with goToURL
The easiest way is to capture the information from page 1 with whatever dynamic
language you are using (PHP, ASP, etc.) and insert it into a variable. Then
you can reuse the form information on page 2 by calling the variable.
For example, in PHP you would insert this on page 2:
<?php
$passed_info = $_GET['field_name'];
?>
Where 'passed_info' is whatever you want to call your variable, '$_GET' is the
method you specified for your form on page 1 (either 'get' or 'post'), and
'field_name' is what you named the form field you want to capture.
rilkesf Guest



Reply With Quote

