|
Hello everybody
I have a strange behaviour on an image link with hover image.
When we click and then leave (quickly) the link, the alt is dispayed like if there was no image = alt attribute is displayed, just before new page is openned.
to reproduce :
http://jsfiddle.net/BuETP/1/[^]
click the button and just leave it quicky. "alt" attribute is displayed about 1/2 second...
Can't reproduce it on IE, just in Chrome.
Have you an idea on what i'm doing wrong ? Thanks very much !
|
|
|
|
|
you mean that in pure HTML and JavaScript
<img
src='http://www.html-5.com/images/click-me-normal.png'
alt='alttt'
onmouseenter="javascript:this.src='http://www.html-5.com/images/click-me-hover.png'"
onmouseout="javascript:this.src='http://www.html-5.com/images/click-me-normal.png'"
>
please use attribut TILE too (value of TITLE should be not hte same like value of ALT).
try onmouseover
for IE
onmousedown Fires when the user clicks the object with either mouse button.
onmouseenter Fires when the user moves the mouse pointer into the object.
onmouseleave Fires when the user moves the mouse pointer outside the boundaries of the object.
onmousemove Fires when the user moves the mouse over the object.
onmouseout Fires when the user moves the mouse pointer outside the boundaries of the object.
onmouseover Fires when the user moves the mouse pointer into the object.
onmouseup Fires when the user releases a mouse button while the mouse is over the object.
onmousewheel Fires when the wheel button is rotated.
ALT alt Sets or retrieves a text alternative to the graphic.
SRC src Sets or retrieves a URL to be loaded by the object.
----------------------------------------------------------------------------
<img
id="ImgId"
src='http://www.html-5.com/images/click-me-normal.png'
alt='alttt'
onmouseenter="javascript:ImgOnMouseXXX('ImgId',true);"
onmouseout="javascript:ImgOnMouseXXX('ImgId',false);"
>
var ImgUrlOnMouseover='http://www.html-5.com/images/click-me-hover.png';
var ImgUrlOnMouseout='http://www.html-5.com/images/click-me-normal.png';
function ImgOnMouseXXX(IDOfIMG,state)
// state
// true onmouseover or onmouseenter
// false onmouseout
{
// params are unchecked
var PointerOfIMG;
var SrcOfIMG=ImgUrlOnMouseout; // normal
var PointerOfIMG=document.getElementById(IDOfIMG);
if(PointerOfIMG!=null)
{
if(state){SrcOfIMG=ImgUrlOnMouseover);
PointerOfIMG.src=SrcOfIMG; // need time to request data of img
// if you want check time state use readyState
}
}
for IE
readyState Property Internet Development Index
--------------------------------------------------------------------------------
Retrieves a value that indicates the current state of the object.
Syntax
HTML N/A
Scripting [ sState = ] object.readyState
Possible Values
sState String that receives one of the following values.uninitialized Object is not initialized with data.
loading Object is loading its data.
loaded Object has finished loading its data.
interactive User can interact with the object even though it is not fully loaded.
complete Object is completely initialized.
The property is read-only. The property has no default value.
Remarks
An object's state is initially set to uninitialized, and then to loading. When data loading is complete, the state of the link object passes through
the loaded and interactive states to reach the complete state.
The states through which an object passes are determined by that object; an object can skip certain states (for example, interactive) if the state does not apply to that object.
Data source objects and databound elements are normally populated asynchronously, and certain programmatic operations can only be performed reliably
on databound objects when they are ready for use. Therefore, the appropriate code should be written to confirm the readyState of objects prior to
performing certain operations on them. For example, walking the rows of a table should not be attempted until after the table has reached the complete state.
The readyState property enables the status of an object to be tested. The correct place to test the readyState property is in the event handler for
onreadystatechange. Similarly, a data source object (DSO) fires the ondatasetcomplete event to notify the Web page that the dataset is ready for programmatic operation.
Standards Information
There is no public standard that applies to this property.
Applies To
document, FRAME, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio,
INPUT type=reset, INPUT type=submit, INPUT type=text, LINK, SCRIPT, TABLE, TBODY, TD, TFOOT, TH, THEAD, TR
|
|
|
|
|
I am currently thinking of writing an AutoFill plugin/widget which will take my personal data such as First Name, Last Name etc from a file/javascript and will automatically fill it in web page form. I have read till now to build a plugin which works for all browsers, I have two options:- 1) To make a Jquery UI widget 2) To make a NPAPI plugin
Is there any other easier method to develop an autofilling plugin, and which option to take i.e. NPAPI plugin or Jquery widget ? Thanks
|
|
|
|
|
Hi i am rafiq,
What is the default value of float and double datatype in Java? Its my interview questions could anyone tell me the answer please..
|
|
|
|
|
You would get a better response if you post this question in The Java Forum.
Here is a link that explains all java data types including default values: Data types
|
|
|
|
|
Perhaps your interviewer should have started by asking you the difference between Java[^] and JavaScript. Apart from some vaguely similar syntax, they're completely different things.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
I'm trying to setup a shopping cart form function (add to cart button) which is called via a java script - I have this in a pop-up window and want to have the "add to cart" button both close the pop-up window and also load the info in the main window - anyone know what script modifications I need to have?
here is part of my current code in the pop-up window:
any help would be super!
|
|
|
|
|
If you are having this button in popup, then it would not be possible to get control of main windows once you close this popup right.
So my suggestion would be to have a js file common to both main window and popup.
And have a js function in it to close the child window and then trigger update on main window.
On click of add to cart button, trigger this function.
Hope this should be helpful.
|
|
|
|
|
Thank you for the help - if you had some code that would help me please let me know - thanks
|
|
|
|
|
First thing you'll need is to store the reference of the popup window.
Then you can use it to close the popup and refer to window.location object for updating the page as shown below.
var childWin = window.open(url,name,params)
function closeWindow()
{
childWin.close();
window.location.href = "<new url>";
document.getElementById("divId").innerHTML = "<updated html>";
}
If you want to just update a part of the page, then you can handle it through the DOM objects (document).
|
|
|
|
|
here is my complete add to cart code:
<form class="cart" action="index-shop.php" method="post"><input type="hidden" name="my-item-id" value="book 1" /><input type="hidden" name="my-item-name" value="book 1" /><input type="hidden" name="my-item-price" value="35.00" /><input type="hidden" name="my-item-url" value="http://www.amazoni.![enter image description here][1]com" />Qty: <input type="text" name="my-item-qty" value="1" size="3" /><input class="button" type="submit" name="my-add-button" value="add to cart" /></form>
|
|
|
|
|
I won't be able to change this code.
You can get detailed information here.
|
|
|
|
|
better if you stay on current window. Use jquery dialog for this kind of scenario.
html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$( "#cart" ).dialog();
});
</script>
</head>
<body>
<div id="cart" title="Basic dialog">
<p>Use cart item to add in cart list.</p>
</div>
</body>
|
|
|
|
|
Yes, this should work as well.
|
|
|
|
|
can i send the email by javascript on html web form.
|
|
|
|
|
Your javaScript would have to call a webservice because JS executes on the client machine so it cannot send email. You can use the jQuery library and call .ajax() to call your webservice to send the email.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I recently added tinymce to a site I'm developing, and other javscript code appears to have stopped working as a result. Is there an easy way to find conflicts that could cause problems?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I use Internet Explorer, the F12 Key.
IE11 F12 is pretty slick now, You choose the debug mode, the icon of a bug, load your page, and the cursor in the F12 box will stop on error, and give you an idea of the error. to continue, right click and choose "Run to Cursor"
Some of the messages are vague, so then you just search the message text for an answer.
For stuff I write, I run it through JavaScript Lint, to check for errors.
[Online Lint^]
|
|
|
|
|
|
Ummmm, wake up. This thread is six months old.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
This is a piece of the code I'm working with and the only part giving me problems. I'm using the combo box to give me both the Line2_flag and the screencharge. Without this particular piece of code the form works fine so I know it's just this snippet. Any help is appreciated. Thanks!
<select name="inkcolors" size="1" id="inkcolors" class="FormStyle"
<option selected value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
var = Line2_flag;
var = screencharge;
if(form.inkcolors[1].selected){
Line2_flag = 1.75;
screencharge = 1;
}
if(form.inkcolors[2].selected){
Line2_flag = 2.25;
screencharge = 2;
}
if(form.inkcolors[3].selected){
Line2_flag = 2.75;
screencharge = 3;
}
|
|
|
|
|
You may like to explain what the problem is.
Veni, vidi, abiit domum
|
|
|
|
|
Sorry I wasn't clearer, but I did receive my answer on another site so I will post it here in case it helps.
<html>
<form>
<select name="inkcolors" size="1" id="inkcolors" class="FormStyle"
<option selected value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</form>
<script>
var Line2_flag = null;
var screencharge = null;
var field = document.forms[0].elements['inkcolors'];
var selected = field.options[field.selectedIndex].value;
if (selected === "1") {
Line2_flag = 1.75;
screencharge = 1;
} else if (selected === "1") {
Line2_flag = 2.25;
screencharge = 2;
} if (selected === "3") {
Line2_flag = 2.75;
screencharge = 3;
}
</script>
</html>
|
|
|
|
|
All well and good but you still did not explain what the original problem actually was.
Veni, vidi, abiit domum
|
|
|
|