button in html

houssam_ballout

New Member
Hello all,
how can I make a button to return a mini-window when I press on it (of course that mini-window will contain results that I specify).
I have done it via JavascRipt , is that a right way/
thanks
 
Hello all,
how can I make a button to return a mini-window when I press on it (of course that mini-window will contain results that I specify).
I have done it via JavascRipt , is that a right way/
thanks


Yes. use the onClick method in the input field and create a javscript function in the <head> of the page that opens the "mini-window".

Code:
<html>
<head>
<script type="text/javascript" >
 
function openMiniWindow()
{
 
//place mini-window code here...
 
}
 
</script>
</head>
<body>
 
<input type="button" id = "miniWindows" onClick="openMiniWindow();" />
 
</body>
</html>
 
Yes. use the onClick method in the input field and create a javscript function in the <head> of the page that opens the "mini-window".

Code:
<html>
<head>
<script type="text/javascript" >
 
function openMiniWindow()
{
 
//place mini-window code here...
 
}
 
</script>
</head>
<body>
 
<input type="button" id = "miniWindows" onClick="openMiniWindow();" />
 
</body>
</html>
right..
and if you don't want to use a button, you can use everything like an imeage always usimg the method onClick="openMiniWindow();"
 
For text boxes I tend to use the onBlur.. as soon as you click or tab onto another field, the onBlur event is triggered... It is really good for validating a textbox!
 
well I have 2 questions:
1- For sfr, what do id means in the html tags?
2- can u explain what do u mean by the method onBlur?

1. I believe the standard definition of an id is that it uniquely identifies an element within a document. You have the ability in JavaScript to manipulate the values within fields.

For example, if I create a text box with an id of lastName:
<input type="text" id = "lastName"/>

in my JavaScript code I can get the value of what is in the text box by using:
document.getElementById("lastName").value;

and store it in a variable:
var temp = document.getElementById("lastName").value;


2. the onBlur can be used instead of onClick:

<input type="button" id = "miniWindows" onBlur="openMiniWindow();" />
 
Back
Top