Jump to content

How Do You Activate The Button In Ie?


Recommended Posts

I hope for Dale support with this:

the source code looks like that:

'<input type="button" value="Stay in the ' + traininggrounds + '" name="' + traininggrounds + '

When i visualize the form elements they look something like that:

0 INPUT market Form Input Type: hidden Value: 1 DispHTMLInputElement

1 INPUT market Form Input Type: button Value: Stay in the market DispHTMLInputElement

if i try to see the value of "market" it shows "1" not "Stay in the.." so i cant push the button in my code.

i've tryed something like this, but it didn't work:

code:

$o_inputs = _IETagNameGetCollection ($oIE, "Input")

For $o_input in $o_inputs

if strleft($o_input.value,7) = "Stay in" Then

$o_input.click

ExitLoop

EndIf

next

AutoIt if more than a hobby. Is a way of life!http://www.autoitscript.com/forum/index.php?showtopic=26002 -my first projecthttp://www.autoitscript.com/forum/index.php?showtopic=26103 -my second project
Link to comment
Share on other sites

<table width="100%" class="main">

<tr><td valign="top"><p align="center"><image src="images/mountains.jpg"><br><p align="center"><script language="javascript">

var numberscenarios=2;

var traininggrounds="mountains";

var nr="108";

var last_id=0;

var scenarios= new Array(numberscenarios);

scenarios[0]= new Array(7);

scenarios[0]["intro"]="You see a pile of rocks lying on the road. You wonder whether you should have a look.";

scenarios[0]["failtext"]="You find nothing suspicious, must have been an avalanche.";

scenarios[0]["succestext"]="As you approach the tree, a handfull of robbers jump from behind the rocks.";

scenarios[0]["followbutton"]="Let's check it out.";

scenarios[0]["letgobutton"]="It's not on our way";

scenarios[0]["attackbutton"]="Fight!";

scenarios[0]["runbutton"]="Run!";

scenarios[0]["id"]=36;

scenarios[1]= new Array(7);

scenarios[1]["intro"]="A famous thief is sighted in this area.";

scenarios[1]["failtext"]="You see a triumphant Lieutenant who already captured the thief.";

scenarios[1]["succestext"]="The thief is there, along with a great number of friends.";

scenarios[1]["followbutton"]="Look for him";

scenarios[1]["letgobutton"]="Not important";

scenarios[1]["attackbutton"]="Attack";

scenarios[1]["runbutton"]="Wife's calling me home.";

scenarios[1]["id"]=48;

function initial_scenario(number){

var r=(Math.floor(Math.random() * number));

document.write('<div id="intro">' + scenarios[r]["intro"] + '</div>');

document.write('<form name=myform action="index.php" method="post"><br>');

document.write('<input type="hidden" name="' + traininggrounds + '" value="1">');

document.write('<input type="hidden" name="last_i" value="' + r + '">');

document.write('<input type="hidden" name="nr" value="' + nr + '">');

document.write('<div id="sid"><input type="hidden" name="scenario_id" value="' + scenarios[r]["id"] + '"></div>');

document.write('<div id="buttons"><input type="button" value="' + scenarios[r]["followbutton"] + '" name="attack" onclick="followScenario(' + r + ')">');

document.write('<input type="button" value="' + scenarios[r]["letgobutton"] + '" name="run" onclick="changeScenario()"></div>');

document.write('</form>');}

function changeScenario(){

var r=(Math.floor(Math.random() * numberscenarios));

document.getElementById("intro").innerHTML = scenarios[r]["intro"];

document.getElementById("sid").innerHTML = '<input type="hidden" name="scenario_id" value="' + scenarios[r]["id"] + '">';

document.getElementById("buttons").innerHTML = '<input type="button" value="' + scenarios[r]["followbutton"] + '" name="attack" onclick="followScenario(' + r + ')"><input type="button" value="' + scenarios[r]["letgobutton"] + '" name="run" onclick="changeScenario()">';}

function followScenario®{

var rn=(Math.floor(Math.random() * 5));

if (rn!=1){

document.getElementById("intro").innerHTML = scenarios[r]["succestext"];

document.getElementById("buttons").innerHTML = '<input type="submit" value="' + scenarios[r]["attackbutton"] + '" name="fight"><input type="button" value="' + scenarios[r]["runbutton"] + '" name="run" onclick="changeScenario()">';

}

else {

document.getElementById("intro").innerHTML = scenarios[r]["failtext"];

document.getElementById("buttons").innerHTML = '<input type="button" value="Stay in the ' + traininggrounds + '" name="' + traininggrounds + '" onclick="changeScenario()"><input type="submit" value="Return to the city" name="city">';

} }

initial_scenario(numberscenarios);

AutoIt if more than a hobby. Is a way of life!http://www.autoitscript.com/forum/index.php?showtopic=26002 -my first projecthttp://www.autoitscript.com/forum/index.php?showtopic=26103 -my second project
Link to comment
Share on other sites

What you have provided is Javascript functions. In general, IE.au3 and the DOM operate on rendered HTML.

Dale

p.s. The Firefox DOM Inspector for something like MODIv2 (Google for it) may help you

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...