|
He, he, he, ha.
SA will smile when/if he reads this.
Have you tried looking at the code in a syntax hi-lighting editor? Have a very close look at the HTML for your button.
Last time I checked, ö nclick is not a function. Get rid of that accented charater and replace it with an 'o'
That's right - your code was never getting called. Using the javascript debugger in your browser may have told you sooner that the onclick event wasn't firing.
But I picked it up in Notepad++ since the word wasn't coloured red
önclick = "try{OnGenReq();}catch(e){alert(e);}"
onclick = "try{OnGenReq();}catch(e){alert(e);}"
|
|
|
|
|
I'm not so sure about that. I've seen other messages in CP forums where cut'n'paste seems to mutate lower case o into an accented one. I haven't seen enough occurrences to pick the pattern, but I'm sure there is one.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
I don't quite follow - "I'm not so sure about that" not sure about what?
I realize there's been quite a few of these onclick --> önclick occurances. SA made the first comment I saw about the trend, hence the reference to him.
I'm still waiting to see anything to suggest to me that it's not the source of the copying that's erroneous. It's not like every instance of o is replaced with ö.
There's also only 1400 results on code project for 'önclick=', dating back to 2009.
Whatever the source, I'm sure getting frequent laugher miles from them.
|
|
|
|
|
Not sure that the accented 'o' was actually in the source that OP pasted from.
As you noted, there are many occurrences, and I can't imagine all those members posting the same error. Hell, most of us couldn't even generate that character on our keyboards!
I remain to be convinced that it's not an artefact of the cut/paste process. Some weird interaction between clipboard and browser?
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Ah, now I understand.
Yeah, it was my initial thought - perhaps something in non-english character fonts being converted back and forth.
Though there's only 1 instance of önmouseup= in codeproject (google: 'site:codeproject.com önmouseup=')
Fun, fun. Alan Turing would be so bored....
_in_2780 - It's just occurred to me - don't s'pose you live in Katoomba?
|
|
|
|
|
enhzflep wrote: live in Katoomba?
Got it in one! Also, an obscure reference to the first bisync protocol I implemented in the dark ages of the 1970's.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Woo-hoo! I've looked at your username dozens of times and tried to work out what the number could have referred to. I kept coming back to the idea that it was a reference to a time ~ 800 years from now. Last night the penny dropped like a sledgehammer.
Guess what? I figured out where the ö character comes from. You were spot on - there's a pattern alright.... It's a deliberate feature of the board!
If you enter some javascript into the editor and it contains onXXXXXX functions in it, the first letter in the preview gets changed to an ö _unless_ it has been html encoded. Alan would still be bored though..
Example:
Good - pre-block + html encoded
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<button onclick="this.disabled='disabled';">Disable Me</button>
</body>
</html>
Good - html encoded
<html>
<head>
</head>
<body>
<button onclick="this.disabled='disabled';">Disable Me</button>
</body>
</html>
Bad - in pre tags, not html encoded
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<button onclick="this.disabled='disabled';">Disable Me</button>
</body>
</html>
Bad - neither contained in pre block nor html-encoded
Disable Me
|
|
|
|
|
Good one!
Your next assignment is to work out a script injection attack against which that character substitution is the defence.
OT: Where are you? If you're in a timezone near me, you keep pretty weird hours.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
How about a link to someone's homepage that actually logs the reader out of CP?
Visit my homepage: <span style="color: green; cursor:pointer;" onclick="location.href='http://www.codeproject.com/script/Membership/LogOff.aspx';">www.myCrappySite.net</span>
Which displays as:
Visit my homepage: www.myCrappySite.net
Though this gets defeated in two ways. First, the word 'cursor' gets replaced with 'removed' - next the 'onclick' --> 'önclick'
So it both takes away the sheep disguise and removes the wolf's teeth.
Cheers,
Simon_in_3175 - (not currently constrained by the hours of the business day)
|
|
|
|
|
Hi guys,
I have a small question, I am creating a website and have created a table using ul elements. (I used ul as this was easier to animate using javascript and it does what i want.... I did try using tables and it messed up.
When I click on one of the ul items the page stays where it is. However when i click another one the page then shoots to the top. I have read around and some people say do the following
<a href = "#!" >blah</a>
However this still sends the page to the top.
If any body knows any tips/tricks as to how to solve this it would be mighty helpful.
|
|
|
|
|
You must of fired a postback to the same page, and the page scroll position reset back to the top.
Hyperlinks are designed to navigate to a new page, unless your using the hyperlink to scroll the page to a designated position.
|
|
|
|
|
Got this link about the Samsung smart app challenge. http://samsung.com/in/smartappchallenge.
Can someone please guide me how to start about Smart tv apps? what kind of apps can be made on tv?
|
|
|
|
|
Isn't that the challenge?
2A
|
|
|
|
|
I guess its a contest, till 30aug.
|
|
|
|
|
Have you looked at the resources section, it even includes some tutorials?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
ok.. will surely have a look that. thanks Richard.
Any idea on what kind of apps can be made for TV.
|
|
|
|
|
prithveesh.goel wrote: Any idea on what kind of apps can be made for TV.
No, as I said earlier, go and look at the documentation and the tutorials.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hey guys.
I'm looking to do some Javascript validation for drop down lists. I have the idea, I think, I just can't get it to work.
Heres the javascript
function Test() {
var ddlDevice = document.getElementById("<%=ddlDeviceType.ClientID%>");
if (ddlDevice.value == "---Please Select---") {
window.alert("Test");
ddlDevice.focus();
return false;
}
Heres the code behind
ddlDeviceType.Attributes.Add("onblur", "Test()");
I need it to be client side, and this kid of style, if that makes sense?
Thanks Guys
|
|
|
|
|
Add this to your dropdown control in aspx page .
onChange="javascript:ddlClick()"
<asp:DropDownList ID="DropDownList2" runat="server" onChange="javascript:ddlClick()"></asp:DropDownList>
<script type="text/javascript">
function ddlClick()
{
}
</script>
|
|
|
|
|
The <%client.id %> is for when your object is on a webform.
in code behind, you have to use a static id value.
So make sure the object exist first, it not, then it's your id, and javascript could not find it.
function Test() {
var ddlDevice = document.getElementById("_ddlDeviceType");
alert(ddlDevice);
if (ddlDevice.value == "---Please Select---") {
alert("Test");
ddlDevice.focus();
}
return false;
}
ddlDeviceType.Attributes.Add("id", "_ddlDeviceType");
ddlDeviceType.Attributes.Add("onblur", "Test(); return false;");
|
|
|
|
|
I wrapped up this code, did a final test, and it doesn't work on IE8 in XP and Server 2003. I tested it on firefox, Windows Vista IE, with developer mode for IE7, 8 and 9, works fine.
I can't get it to render in the DOM, and I'm completly baffled by it.
This is the simple part of the code. There's a more complex half not posted, and I really like the way createElement works, like creating html in code behind, it's easy to follow.
I remember reading something about createElement not working very good in IE8, but I can't find the web site again.
I tried document.body.appendChild(table_Progress) just as a test, but it still didn't render.
var table_Progress = document.createElement("table");
table_Progress.id = "_table_Progress";
table_Progress.setAttribute("cellpadding", "0");
table_Progress.setAttribute("cellspacing", "0");
table_Progress.setAttribute("border", "0");
table_Progress.style.width = "100%";
var tr_Progress_Image = document.createElement("tr");
table_Progress.appendChild(tr_Progress_Image);
var td_Progress_Image = document.createElement("td");
td_Progress_Image.style.width = "100%";
td_Progress_Image.style.height = "240px";
td_Progress_Image.style.verticalAlign = "bottom";
td_Progress_Image.style.textAlign = "center";
td_Progress_Image.style.margin = "0px auto";
tr_Progress_Image.appendChild(td_Progress_Image);
var image_Progress = document.createElement("img");
var imgProgress = $('[id*="_txt_JQuery_ImageBrowser_LibraryProgress"]').val();
image_Progress.src = imgProgress;
td_Progress_Image.appendChild(image_Progress);
var tr_Progress_Message = document.createElement("tr");
table_Progress.appendChild(tr_Progress_Message);
var td_Progress_Message = document.createElement("td");
td_Progress_Message.style.width = "100%";
td_Progress_Message.style.height = "240px";
td_Progress_Message.style.verticalAlign = "top";
td_Progress_Message.style.textAlign = "center";
td_Progress_Message.style.margin = "0px auto";
tr_Progress_Message.appendChild(td_Progress_Message);
var span_Progress_Message = document.createElement("span");
span_Progress_Message.style.color = "rgb(0,0,0)";
span_Progress_Message.style.fontSize = "2.0em";
span_Progress_Message.style.fontWeight = "bold";
span_Progress_Message.innerHTML = "Generating Product Library Browser";
td_Progress_Message.appendChild(span_Progress_Message);
$('[id*="_panel_Preview_Object"]').empty();
$('[id*="_panel_Preview_Object"]').append(table_Progress);
|
|
|
|
|
ie8 is really strict, so it was a matter of dotting the i's and crossing the t's.
If you make a small mistake, there is no warning, so like on the span tag, it's innerText and not innerHtml.
On tableRow's, it's insertRow(-1),
and on tablecell's it's insertCell(-1)
[EDIT]
Well after hours of reading last night, I found out that I'm running IE7, even though it's IE8 on XP and Server 2003. I also learned that IE7 and IE8 have there own version of creating html markup using createElement and appendChild.
So it's a matter of learning which properties work in both Gecko based browsers and IE, and which don't. It's sort of like VHS and Beta, they look the same, but are different.
I tried testing for createElement, to see if the DOM created it, by adding an ID to the element, and going back and checking the value, to maintain 1 version, but the element was created and an ID was assigned anyway on both.
So for now, I just did a browser check, and switch between the 2 versions.
I thought I was doing pretty good with Javascript and Jquery, but I have much more to learn about it, or I'm just using both more now and taking it to much higher levels now.
modified 16-Jul-12 12:44pm.
|
|
|
|
|
Hi,
i click button a web page in webbrowser on c# form application. there is a button named "ileri" and i click this button , javascript run, then page refresh and submit. Then a blank page, why blank page?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-9" http-equiv=Content-Type></HEAD>
<BODY></BODY></HTML>
what is problem?
|
|
|
|
|
The page may be redirect to a blank page
|
|
|
|
|
Good day
i am new to knockout ,
I am bringing back the data from a control and i am doing the autocomplete and i show the results in a listbox as depicted below
$(function () {
$("#txtSearchString").keyup(function () {
$("#lstSearchOptions").hide('fast');
if ($("#txtSearchString").val().length >= 3)
{
var data = {}
data.searchString = $("#txtSearchString").val();
$.getJSON("/SearchCars/SearchCars", data, function (result) {
var viewModel =
{
SearchOptions: ko.observableArray(result),
}
ko.applyBindings(viewModel,document.getElementById("stSearchOptions"));
ko.applyBindings(viewModel, document.getElementById("selectedcarid"));
if (result != null)
{
$("#lstSearchOptions").show('fast');
}
});
}
});
});
now when the user select something i need to get the selected ID and i also want the Year and this is my HTML
<select id="lstSearchOptions" data-bind="options: SearchOptions, optionsText: function(item) {
return item.Model + ' ' + item.Type + ' ' + item.Year}, optionsValue: 'CarId'"
multiple="multiple" size="-1" class="searchOptions">
</select>
and i have this to assign the value
$(function () {
$("#lstSearchOptions").change(function () {
$("#selectedcarid").val($("#lstSearchOptions option:selected").val());
});
$("#lstSearchOptions").blur(function () {
$("#lstSearchOptions").hide("fast");
});
});
so i can get the ID from here
$("#selectedcarid").val($("#lstSearchOptions option:selected").val());
but have a Problem to getting the year
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|