Using Actionscript 2.0 to access <div> value in XHTML file - xhtml

I have a (.xhtml) file that I need to access a particular <div> from my flash movie using Actionscript 2.0.
My (.xhtml) file is roughly in this format:
<html>
<head>
<title>Landing</title>
</head>
<div id="mainArea">
<div id="content">
<div id="calloutContent">
<div id="callout1">Search Our QA Database</div>
</div>
<div id="TitleContent">
<div id="title1">Heading One</div>
<div id="title2">Heading Two</div>
</div>
</div>
</div>
</body>
</html>
I need to access the value of <div "title1">, so that would be the text "Heading One", then I need to assign that to a variable in my flash move, then display it in a text field. I have looked at "XPathAPI", but I just cannot get it working, as the file is not pure XML.
I have looked at loading XML, and access nodes within that, which works fine, but when I try (.xhtml), in the format above, I just cannot get it to work.
Any help would be greatly appreciated. If you need any further information, please let me know.
Thanks, I am a bit desperate.
Alan...

Using meta tags you can send variables into a flash file when embedding the swf file onto a page... I don't remember how exactly but 1 quick google should reveal it... after that if the value int he div will be changing just use javascript to keep up with it.. or php..

Related

How do I get button to save to console

<div class="card content-return">
<div class="card-image image">
<button id="favoriteBtn">Save2Favorites</button>
javascriptenter image description here
I’m a beginner and I’m having an issue getting my favoriteBtn to function when I click on it. Button doesn’t register in the console I get an error message in the console. What can I do? im using HTML and Javascript
So, the structure of a HTML page is that the code should be written in between <html> tags.
Even if the tags aren't written, the browser will still render the file. As shown below.
In the above picture, you can see that even if the code in the text editor is the one which you gave in your question the browser still generated the <html> and <body> tags. This maybe the error which you were talking about in your question. Nothing to worry.
Given the code from your question, we will need to have some JS (JavaScript) code for the button to function. And we will be calling that function in the onClick attribute in our HTML button. Refer the below image.
So, in the above code, we have added a method called saveFavorites() and we are calling it in our onClick attribute of our button.
Note - Ignore the yellow messages in the console, those are just warnings.
Posting the HTML Code Below -
<html>
<head>
<script>
function saveFavorites(){
alert("Button Clicked.");
}
</script>
</head>
<body>
<div class="card content-return">
<div class="card-image image">
<button onclick="saveFavorites()" id="favoriteBtn">Save 2 Favorites</button>
</div>
</div>
</body>
</html>

Can GMail html body be formatted with Materialize, Bootstrap etc. in GAS?

It's possible to style the html beforehand when sending email with an html body from Google Apps Script with the GMailApp.sendEmail method. But when trying to style using Materialize it fails for me and the mail shows up in basic unformatted html. I am aware the html templating is finicky but can styling frameworks at all be applied? If so, does anyone know how to debug what is causing it to fail?
Sample GA script (code.gs):
function spamMe() {
let recipient = 'mymail#gmail.com';
let subject = 'Your daily serving of spam. For FREE!';
let html = HtmlService
.createTemplateFromFile('emailbody')
.evaluate()
.getContent();
GmailApp.sendEmail(recipient, subject, '', { htmlBody: html });
}
Sample html body template (emailbody.html):
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
</head>
<body>
<div class="container">
<h1>Hey worldo!</h1>
<div class="row">
<div class="col s12 m5">
<div class="card-panel teal">
<span class="white-text">I am a very simple card. I am good at containing small bits of information.
I am convenient because I require little markup to use effectively. I am similar to what is called a panel in other frameworks.
</span>
</div>
</div>
</div>
</div>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</body>
</html>
In theory it could work, as long as you inlined the code (style="..." rather than <link>). That's a really big "could" though, since most systems like Bootstrap, Materialise are built for the web, which functions quite differently than email.
So, most (all?) systems rely on <div>s, and Outlook desktops don't play well with <div>s, this is not going to work well for you.
Digging a little deeper, with two and three columns, you would set them up differently too so they stack even without media queries.
Also, a great many components are coded differently, and don't use, for example, flexbox which Bootstrap depends upon. See https://www.caniemail.com/ for detail that way.
However, there is a system called MJML (https://mjml.io/) that is close to what you may want. But it's compiled, rather than class-driven.

HTML5 section disappears when on server

I am currently prototyping a website using Foundation 5. I have a HTML5 section which contains an image, header and repeated background. This displays fine locally but as soon as I move the site over to my web server everything in the section tag disappears. It appears for a split second then disappears.
<section id="banner">
<div class="row">
<div class="large-12 columns">
<img class="logo" src="img/logo.png" alt="Logo">
<h1>Heading</h1>
</div>
</div>
</section>
Does anybody know why this is occurring? Seems odd that it only happens on the server.
Thanks in advance!
Please check the Stylesheet (CSS file) has been kept in right folder and CSS path is correct. I have used section tag in my own HTML5 Tutorial website and it is working perfectly. You can visit http://www.html5tutorial4u.com and check the source code of home page. I hope that it will help you a bit.

Why is my png not displaying on my WebPages site?

I've started my asp.net WebPages site using the "Starter Site" template. It contains a layout page, _SiteLayout.cshtml, that is referenced in Default.cshtml.
In _SiteLayout, there is this HTML:
<header>
<div class="content-wrapper">
<div class="float-left">
<p class="site-title"></p>
</div>
It originally had one of the images that "came with" the site instead of "something.png" but since I did not see the original image in the browser when I ran it, I changed it first to ~/Images/orderedList7.png and then to "something.png" in an attempt to raise an err msg or warning. But no! Tolerance, your name is html! (or is it vice-versa?).
At any rate, why am I not seeing the image specified in the layout file when I run the site?
<header>
<div class="content-wrapper">
<div class="float-left">
<p class="site-title"><img src="~/Images/something.png" /></p>
</div>
Try that, you are using an anchor instead of an image tag.

asp.net MVC3 auto generate meta keywords and description based on page content

I'm working on an MVC3 web application using the razor view engine. I'm looking for a solution to generate meta keywords and description automatically on my pages.
I've already found this solution here on stackoverflow, the idea is looking good. But since I'm planning to post blogs etc... on my website I want the meta keywords and description to be auto generated based on the content of the page.
Soo far I've got the following things in mind. Let's say that the current HTML looks like below;
<html>
<head>
</head>
<body>
<header></header>
<div id="container">
<div id="sideBar"></div>
<div id="pageHeader"></div>
<div id="content">
<!--This part contains the dynamic content-->
</div>
<div class="clear"></div>
</div>
<footer></footer>
</body>
</html>
The desired situation for me would be something like below;
<html>
<head>
#Html.MetaKeywords()
#Html.MetaDescription()
</head>
<body>
<header></header>
<div id="container">
<div id="sideBar"></div>
<div id="pageHeader"></div>
<div id="content">
<!--This part contains the dynamic content-->
</div>
<div class="clear"></div>
</div>
<footer></footer>
</body>
</html>
Said all this I've got the following questions left unanswered, hope someone can help.
The situation described above, with the HTML-helpers. Is this an good and logic approach to generate keywords and description on every single page, based on the content?
If this is, does anyone has experience and maybe an good example?
If not, are there any other good options? Other then using an attribute on each controller action? This still is an option, but it doesn't generate keywords an description based on my page content.
I hope someone can help me out. Thanks!
If I'm understanding correctly, you want to be able to auto generate the metadata based on the text inside the content div?
I would try passing that text / html / model into the MetaKeywords and MetaDescription functions, and allowing them to parse / analyze / look-up the information you need to put in the metadata.
<html>
<head>
#Html.MetaKeywords(Model.ContentText)
#Html.MetaDescription(Model.ContentText)
</head>
<body>
<header></header>
<div id="container">
<div id="sideBar"></div>
<div id="pageHeader"></div>
<div id="content">
<!--This part contains the dynamic content-->
</div>
<div class="clear"></div>
</div>
<footer></footer>
</body>
</html>
You should understand producing page content is the last stage of action processing, it performes directly to HttpContextBase.Response and generally server may never have whole content buffered, it may be sent to client due producing.
You may register your filter globally as described here http://weblogs.asp.net/gunnarpeipman/archive/2010/08/15/asp-net-mvc-3-global-action-filters.aspx so you don't need to put attribute on each action method.
On the _layout.cshtml you can add a #Rendersection("header", false) In the header section!! False for the time being.
Later you have to change this to true or remove the required attribute.
On each page you can use now
#section header{
<meta name="Author" content="1SeoAdvies.nl" />;
Here you add every desired meta tag.
}
beware you don't have meta tags in the header section on the _layout page.

Resources