[SOLVED] JS: ERROR No Properties ?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
dstefani
Forum Contributor
Posts: 140
Joined: Sat Jan 11, 2003 9:34 am
Location: Meridian Idaho, USA

[SOLVED] JS: ERROR No Properties ?

Post by dstefani »

Here is a snippet of source code which generates an error in the javascript console of Firefox:
Here is the error:

Code: Select all

Error: jump1.jumpbox has no properties
Here is the code:

Code: Select all

<div id="dataNav">
<form name="jump1">
<table id="data_nav_table" summary="Data Navigation" cellspacing="0" width="100%" border="0">
<tr>
<td>

<span class="navSummary">Go to page:</span>

<select name="jumpbox" OnChange="location.href=jump1.jumpbox.options&#1111;selectedIndex].value">
<option value="/~donzo/clca/www/admin/index.php?v=kb&p=4&page=1" title="Page 1">1</option>
<option value='' selected>2</option>
</select>

</td>
<td align="right"><input type="button" value="<<" onclick="document.location.href='/~donzo/clca/www/admin/index.php?v=kb&p=4&page=1'" />
<input type="button" value="<" onclick="document.location.href='/~donzo/clca/www/admin/index.php?v=kb&p=4&page=1'" /> <span class="navSummary">Records 4 to 6  of 6</span> </td></tr>
</table>

</form>
</div>
I must be looking right at the problem, but I can't see it!

thanks,

- dstefani
Last edited by dstefani on Wed Mar 02, 2005 6:24 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

var obj = document.forms&#1111;'jump1'].elements&#1111;'jumpbox'];
location.href = obj.options&#1111;obj.selectedIndex].value;
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Although Feyd's code is correct when dealing with javascript items in forms you can abbreviate it to:

Code: Select all

var obj = document.jump1.jumpbox;
location.href = obj&#1111;obj.selectedIndex].value;
Make sure the form name and element names are unique.
User avatar
dstefani
Forum Contributor
Posts: 140
Joined: Sat Jan 11, 2003 9:34 am
Location: Meridian Idaho, USA

[SOLVED]

Post by dstefani »

Make sure the form name and element names are unique.
That was the problem, I knew this code works, I was using it in other places, but in the last few instances I was using it at the top and the bottom of the generate page of data.

Arrg!

:roll:

Thanks!

- dstefani
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I tend to use the full length versions because the code I build is iterative in nature often. I'd require using eval() otherwise. Since some objects have names that will not work in short form, I always go for long form anyways.
Post Reply