Javascript

JavaScript

Posted on

<html>

<head><title></title>

<script>

function checkAnswers()

{

var myQuiz=document.getElementById(“myquiz”);

if(myQuiz.elements[1].checked)

alert(“Congratulation,your answer is correct”);

else

alert(“Your answer is incorrect, please try again”);

}

</script>

</head>

<body>

<form id=”myquiz”  action=”onlinequiz.html”>

<p>Select the name of the tip that goes with the image shown<br/>

<img src=”” alt=””>

<input type=”radio” name=”radiobutton” value=”CPE”/>

<label> Common Programming Error</label>

<input type=”radio” name=”radiobutton” value=”EPT”/>

<label> Error Prevention Tip</label>

<input type=”radio” name=”radiobutton” value=”PERF”/>

<label> Performance Tip</label>

<input type=”radio” name=”radiobutton” value=”PORT”/>

<label> Protability Tip</label><br/>

<input type=”button” name=”submit” value=”submit” onClick=”checkAnswers()”/>

<Input type=”reset” name=”reset” value=”Reset”/>

</p>

</form>

</body>

</html>

6

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com

Advertisements

window object methods

Posted on

<html>

<head><title></title>

<script type=”text/javascript”>

var mywindow

function openCenteredWindow(url)

{

var mywindow

mywindow=window.open(url,”subwind”,400,400,status.resizable);

}

function show_alert()

{

alert(“Hi!!!! I am alert box”)

}

function resizeWindow()

{

window.resizeBy(-100,-100);

}

function closeWindow()

{

if(window.confirm(“do you want to close the browser”))

window.close();

}

</script>

</head>

<body>

<input type=”button” value=”Open a New Window” onClick=”openCenteredWindow(‘WindowsMethods.html’)”/>

<input type=”button” value=”alert” onClick=”show_alert()”/>

<input type=”button” onClick=”resizeWindow()” value=”Resize window”>

<input type=”button” onClick=”closeWindow()” value=”close the window”>

</body>

</html>

1

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com