[prev in list] [next in list] [prev in thread] [next in thread] 

List:       htmlunit-user
Subject:    [Htmlunit-user] select onchange
From:       "Zhang Yufeng" <yuffonzhang () 163 ! com>
Date:       2010-10-19 2:08:30
Message-ID: 201010191008284755252 () 163 ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi, everyone,

I am using htmlunit to test a jsp webpage with javascript in it.

This page has a select element in it as follows:
<select title="inProvince" name="provinceCode" id="provinceCode" onchange="onProvinceCodeChange();" >
<option selected="selected" value="0">one</option>
<option value="110000">two</option>
<option value="310000">three</option> 
</select>

When I use an instance of HtmlSelect to get this select element, and execute 
HtmlSelect select.setSelectedAttribute("110000", true); 
Why the script 'onProvinceCodeChange()' in the onchange attribute is not executed?

So I can't get new form after the option changes?

Anyone can help?

Thank you.
Yufeng 

[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16490"><LINK rel=stylesheet 
href="BLOCKQUOTE{margin-Top: 0px; margin-Bottom: 0px; margin-Left: 2em}"></HEAD>
<BODY style="FONT-FAMILY: verdana; FONT-SIZE: 10pt">
<DIV><FONT size=2 face=Verdana>Hi, everyone,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>I am using htmlunit to test a jsp webpage with javascript in it.</DIV>
<DIV>&nbsp;</DIV>
<DIV>This page has a select element in it as follows:</DIV>
<DIV>&lt;select&nbsp;title="inProvince"&nbsp;name="provinceCode"&nbsp;id="provinceCode"&nbsp;onchange="onProvinceCodeChange();"&nbsp;&gt;</DIV>
 <DIV 
style="TEXT-INDENT: 2em">&lt;option&nbsp;selected="selected"&nbsp;value="0"&gt;one&lt;/option&gt;</DIV>
 <DIV 
style="TEXT-INDENT: 2em">&lt;option&nbsp;value="110000"&gt;two&lt;/option&gt;</DIV>
<DIV 
style="TEXT-INDENT: 2em">&lt;option&nbsp;value="310000"&gt;three&lt;/option&gt; 
</DIV>
<DIV>&lt;/select&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>When I use an instance of HtmlSelect to get this select element, and 
execute </DIV>
<DIV>HtmlSelect select.setSelectedAttribute("110000",&nbsp;true); </DIV>
<DIV>Why the script 'onProvinceCodeChange()' in the onchange attribute is not 
executed?</DIV>
<DIV>&nbsp;</DIV>
<DIV>So I can't get new form after the option changes?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Anyone can help?</DIV>
<DIV><FONT size=2 face=Verdana></FONT>&nbsp;</DIV>
<DIV align=left><FONT size=2 face=Verdana><FONT size=2 face=Verdana><SPAN>Thank 
you.</DIV>
<DIV>
<DIV>
<DIV>Yufeng </DIV></DIV></SPAN></FONT></DIV></FONT></BODY></HTML>



------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev

_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-user


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic