If I create a cookie in Javascript document.cookie = 'unseen' how do I delete it when I navigate away from this page? This is the only cookie I am creating on the page.
I have a recursive function reading a "table of contents" of documents from a database.
I would like to print numbering with the document that reflects where the item is in the tree, e.g.
First item,
1.1 Child of first item,
1.1.1 Child of child of first item,
1.2 Child of first item,
Second item,
2.1 Child of second item,
etc.
Rather stumped about this at the moment - help please?
There is a server changing a batch to add up data on the date and time, but I want to send the end states (normal end or abnormal termination) of this batch to Yahoo! Messenger or one's ID of the MSN messenger as a message, but a page and the document which I am useful for are not found.
Can I send alert message to MSN messenger or Yahoo! messenger from servers?
Hello all,
I have a Document Library that receives a mail every week. I want to show the list of mails with their summaries. Is it possible to get that mail's content in Sharepoint, without deploying a custom code?
Thanks.
Now one Submit button is the default focused control. but I need to set the default focus to another imagebutton. Can only use $(document).ready(function(){ctrl.focus();} ? or has another property to fulfill it?
Hi!
I'm working in a website were we update the content of a div using Jquery.
Inside the content we use to update the div there are some buttons with jquery actions attached.
The first time the document is loaded lightbox is OK, but after the div content is updated the jquery lightbox doesnt works.
Any comments welcome ;)
We are in the process of integrating ASP.NET Business App with Sharepoint. I have some Design questions.
Requirement - From ASP.NET buz application we upload document to Sharepoint Doc Lib 2010 using Web Services. And perform a Search using Serach web service. I would like to know from group are there any disadvantages doing this? Performance etc .. What kind of seacurity consideration i need to be thinking of.
Hello, I am by no means an expert at javascript, but I have been reading Dave Pilgrim's "Dive into HTML5" webpage and he mentioned something that I would like a better understanding of.
He states:
"Finally, you use the double-negative trick to force the result to a Boolean value (true or false)."
function supports_canvas() {
return !!document.createElement('canvas').getContext;
}
If anyone can explain this a little better I would appreciate it!
I need to analyze a document and compile statistics as to how many times each a sequence of words is used (so the analysis is not on single words but of batch of recurring words). I read that compression algorithms do something similar to what I want - creating dictionaries of blocks of text with a piece of information reporting its frequency.
It should be something similar to http://www.codeproject.com/KB/recipes/Patterns.aspx
Do you have anything written in C#?
Is there a way to create a section on a menu for a list of menu items to be populated by something like an ObservableCollection?
I'd like to replicate the Window functionality in Visual Studio, where the open document tabs are listed in a numbered list, limited to the first 10.
In trying to learn JavaScript closures, I've confused myself a bit.
From what I've gathered over the web, a closure is...
Declaring a function within another function, and that inner function has access to its parent function's variables, even after that parent function has returned.
Here is a small sample of script from a recent project. It allows text in a div to be scrolled up and down by buttons.
var pageScroll = (function() {
var $page,
$next,
$prev,
canScroll = true,
textHeight,
scrollHeight;
var init = function() {
$page = $('#secondary-page');
// reset text
$page.scrollTop(0);
textHeight = $page.outerHeight();
scrollHeight = $page.attr('scrollHeight');
if (textHeight === scrollHeight) { // not enough text to scroll
return false;
};
$page.after('<div id="page-controls"><button id="page-prev">prev</button><button id="page-next">next</button></div>');
$next = $('#page-next');
$prev = $('#page-prev');
$prev.hide();
$next.click(scrollDown);
$prev.click(scrollUp);
};
var scrollDown = function() {
if ( ! canScroll) return;
canScroll = false;
var scrollTop = $page.scrollTop();
$prev.fadeIn(500);
if (scrollTop == textHeight) { // can we scroll any lower?
$next.fadeOut(500);
}
$page.animate({ scrollTop: '+=' + textHeight + 'px'}, 500, function() {
canScroll = true;
});
};
var scrollUp = function() {
$next.fadeIn(500);
$prev.fadeOut(500);
$page.animate({ scrollTop: 0}, 500);
};
$(document).ready(init);
}());
Does this example use closures? I know it has functions within functions, but is there a case where the outer variables being preserved is being used?
Am I using them without knowing it?
Thanks
Update
Would this make a closure if I placed this beneath the $(document).ready(init); statement?
return {
scrollDown: scrollDown
};
Could it then be, if I wanted to make the text scroll down from anywhere else in JavaScript, I could do
pageScroll.scrollDown();
I'm going to have a play around on http://www.jsbin.com and report back
I'm trying to rotate a canvas element AFTER it's been appended to the DOM.
Canvas is 600x50 and this is the code at hand:
var canvas = document.getElementsByTagName('canvas')[2];
var ctx = canvas.getContext('2d');
ctx.translate(300, 25); // rotate @ center
ctx.rotate(angle * Math.PI/180);
which isn't accomplishing the task. Am I missing something?
Thanks
Basically I want to strip the document of words between blockquotes. I'm a regular expression newb and even after using rubular, I'm no closer to the answer.
Any help is appreciated.
I'm trying to write a jQuery script that will find the distance to the right edge of the browser window from my css class element and then position the child submenu dropdowns to the right or left depending on the available space to the right. Also it needs to revert to the default settings on hoverout. Here is what I have so far but it's not calculating properly.
$(document).ready(function(){
$('#dnnMenu .subLevel').hover(function(){
if ($(window).width() - $('#dnnMenu .subLevel').offset().left - '540' >= '270')
{
$('#dnnMenu .subLevelRight').css('left', '270px');}
else {$('#dnnMenu .subLevelRight').css('left', '-270px');}
});
$(document).ready(function () {
function HoverOver() {
$(this).addClass('hover');
}
function HoverOut() {
$(this).removeClass('hover');
}
var config = {
sensitivity: 2,
interval: 100,
over: HoverOver,
timeout: 100,
out: HoverOut
};
$("#dnnMenu .topLevel > li.haschild").hoverIntent(config);
$(".subLevel li.haschild").hover(HoverOver, HoverOut);
});
Basically I tried to take the width of the current window, minus the distance to the left edge of the browser of the first level submenu, minus the width of both elements together which would equal 540px, to calculate the distance to the right edge of the window when the first level submenu is hovered over. if the distance to the right of my first level submenu element is less than 540px then the second level sub menu css property is changed to position to the left instead of right. I also know that it needs to revert back to default after hover out so it can recalculate the distance from other positions within the menu structure and still have those second level submenus with enough room to still display on the right of the first level. here is css for the elements in question.
#dnnMenu .subLevel{
display: none;
position: absolute;
margin: 0;
z-index: 1210;
background: #639ec8;
text-transform: none;}
#dnnMenu .subLevelRight{
position: absolute;
display: none;
left: 270px;
top: 0px;}
The site's not live yet and I tried to create a jsfiddle but it doesn't look right. Any help would be greatly appreciated!
Best Regards,
Mario
I want to conduct a quiz using silverlight. This quiz contains few questions and each question will have multiple choices (Radio Buttons). User should select one answer. After completing the quiz I need to display Result.
Is it better to provide the questions and options in XML Document and then retrieve it into silverlight class? If yes, can anybody tell me the procedure to achieve it.
Ok before i make spaghetti of this code i thought id ask around here. ive made a quiz for an online site.
The answers are stored in an array, and ive a function that checks the answers array to what youve clicked. then it counts them and gives you your score.
but i want to change the clor of the right answer wen the user clicks the score button. so the correct answers are highlighted. something like this https://www.shutterpoint.com/Home-Quiz.cfm (just hit submit at the bottom, no need to do the quiz).
the little answer icon at the side looks flashy but id rather just have the text change color. heres how my questions are formatted
<p>Depth of field is controlled by :?</p>
<p id = "question2"><input type="radio" name="question2" id="Answer1" value = "a" onClick ="recordAnswer(2,this.value)"/> The focal length of the lens. <br/>
<input type="radio" name="question2" id="Answer2" value = "b" onClick = "recordAnswer(2,this.value)"/> The size of the aperture opening. <br/>
<input type="radio" name="question2" id="Answer3" value = "c" onClick = "recordAnswer(2,this.value)"/> The distance between the camera and lens. <br/>
<input type="radio" name="question2" id="Answer4" value = "d" onClick = "recordAnswer(2,this.value)"/> All of these. <br/></p>
and these are the two functions that are called throughout. record answer is called every time the user clicks a button
function recordAnswer(question,answer)
{
answers[question-1] = answer;
}
this is the final button which calculates the score
function scoreQuiz()
{
var totalCorrect = 0;
for(var count = 0; count<correctAnswers.length;count++)
{
if(answers[count]== correctAnswers[count])
totalCorrect++;
}
<!--
alert("You scored " + totalCorrect + " out of 12 correct!");
-->
}
another function is best i think. ive already made attemots at it and know i have to set the color using
document.getElementById('question2').style.color = '#0000ff';
question2 being the p id
i think if i take in the value part of (input type....) ill be able to compare it to the answers array.
but im not quite sure how to do this. any helpers?
maybe something like this
document.getElementById("Answer1").style.color = '#0000ff';
using the id part of the (input type line)
i think i got it actually. ill post my answer in a sec
i hve have implemented photo application same as photo application.Now i want to implement zoom and zoom pinch functionality same as photo application.Please provide me any code or document.
Thanks in advance
I have an XML file located at a location such as
http://example.com/test.xml
I'm trying to parse the XML file to use it in my program with xPath like this but it is not working.
Document doc = builder.parse(new File(url));
How can I get the XML file?
Hi,
I would like to open a webpage and run a javascript function from within a java app.
For example I would like to open the page www.mytestpage.com and run the following javascript code:document.getElementById("txtEmail").value="[email protected]";submit();void(0);
This works in a browser...how can I do it programatically?
Thanks!
Hello, I am trying to read a XML document with C#, I am doing it this way:
XmlDocument myData = new XmlDocument();
myData.Load("datafile.xml");
anyway, I sometimes get comments when reading XmlNode.ChildNodes. Is there a way to avoid that? I know that you can avoid reading comments if you use XmlReader, but then, how to get the XmlDocument out of a XmlReader?
Thank you
Tommaso
I'm writing a Chrome extension that uses a content script to modify certain parts of a website. The content script worked fine until I tried to add an options page to my extension.
Right now I'm using an options.html file to save user preferences to localstorage, as you can see here:
<html>
<head><title>Options</title></head>
<script type="text/javascript">
function save_options() {
var select = document.getElementById("width");
var width = select.children[select.selectedIndex].value;
localStorage["site_width"] = width;
}
function restore_options() {
var fwidth = localStorage["site_width"];
if (!fwidth) {
return;
}
var select = document.getElementById("width");
for (var i = 0; i < select.children.length; i++) {
var child = select.children[i];
if (child.value == fwidth) {
child.selected = "true";
break;
}
}
}
</script>
<body onload="restore_options()">
Width:
<select id="width">
<option value="100%">100%</option>
<option value="90%">90%</option>
<option value="80%">80%</option>
<option value="70%">70%</option>
</select>
<br>
<button onclick="save_options()">Save</button>
</body>
</html>
I also have a background.html file to handle the communication between the content script and the localstorage:
<html>
<script type="text/javascript">
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
if (request.method == "siteWidth")
sendResponse({status: localStorage["site_width"]});
else
sendResponse({});
});
</script>
</html>
Then there's the actual content script that looks like this:
var Width;
chrome.extension.sendRequest({method: "siteWidth"}, function(response) {
width = response.status;
});
None of that code actually works. It looks solid enough to me but I'm not a very experienced programmer so I might be wrong.
Could someone explain localstorage to me in layman's terms?
I'm using sIFR 3 r436. When a page is reloaded, and often also on load, in IE8 the background image does'nt appear completely. When clicking on an intern link the background is displayed correctly.
Google Chrome has also minor problems in displaying.
This is the test document:
http://testserver.simplexontwerp.nl/sifr/
I have been testing a lot of different options, also older versions of sIFR, but nothing helps. It would be great if someone could help me!
Is is possible to display html document in J2ME mobile app? Is it possible using for example WebKit? I was looking for some webkit's j2me implementation or some tutorial or advice in google but found nothing.